package advancedGui;

import app.AppInterface;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.SystemTray;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import java.net.URL;
import java.util.ArrayList;
	
public class AdvancedGui  {
	
	private final boolean DEBUG = false;
	
	private String version;
	private AppInterface app;
	private JTabbedPane tabs;
	private AdvancedGuiSync advancedSyncTab;
	private AdvancedGuiLog advancedLogTab;
	
	private JFrame frame;
	
	public AdvancedGui(String version, AppInterface app) {
		this.version = version;
		this.app = app;
	}
	
	public void initGuiComponents() {
		
		if(DEBUG) System.out.println("Init GUI");
		
		//WindowUtilities.setSkin("tigerthemepack.zip");
		//WindowUtilities.setNativeLookAndFeel(); // Examples of other look and feel
		//WindowUtilities.setJavaLookAndFeel();
		//WindowUtilities.setMotifLookAndFeel();
		//WindowUtilities.setWindowsLookAndFeel();
		
		// Adds a frame
		frame = new JFrame("Sync IT");
		
		// Sets the Icon image
		ArrayList<Image> imageList = new ArrayList<Image>();
		URL imgURL = ClassLoader.getSystemResource("skin/SyncITIcon.gif");
		Image image = Toolkit.getDefaultToolkit().getImage(imgURL);
		imageList.add(image);
		imgURL = ClassLoader.getSystemResource("skin/SyncITLogo.gif");
		image = Toolkit.getDefaultToolkit().getImage(imgURL);
		imageList.add(image);
		frame.setIconImages(imageList);
		
		// Initializes JPanels
		advancedSyncTab = new AdvancedGuiSync();
		advancedLogTab = new AdvancedGuiLog();
		
		// Adds the different tabs
		tabs = new JTabbedPane();
		tabs.addTab("Sync", null, advancedSyncTab, "Sync tab");
		tabs.addTab("Log", null, advancedLogTab, "Log tab");
		
		// Sets mnemonics to the tabs
		tabs.setMnemonicAt(0, 'Y');
		tabs.setMnemonicAt(1, 'G');
		
		// Sets up the frame
		frame.getContentPane().add(tabs);
		
		frame.pack();
		frame.setVisible(app.getVisibleGui());
	}
	
}
